//
// Created by Administrator on 2025/4/27/周日.
//
#include "iostream"

using namespace std;


class MyInteger {
    friend ostream &operator<<(ostream &out, MyInteger myInteger);

private:
    int m_Num;
public:
    MyInteger() {
        m_Num = 0;
    }

//    前置++
    MyInteger &operator++() {
//        先++
        m_Num++;
//    再返回
        return *this;//指针指向原始
    }

    //后置++
    MyInteger operator++(int) {
//先返回
        MyInteger temp = *this; //记录当前本身的值，然后让本身的值加1，但是返回的是以前的
//        值，达到先返回后++；
        m_Num++;
        return temp;
    }


};
ostream& operator<<(ostream& out, MyInteger myInt) {
    out << myInt.m_Num;
    return out;
}

//前置++ 先++ 再返回
void test01() {
    MyInteger myInt;
    cout << ++myInt << endl;
    cout << myInt << endl;
}
//后置++ 先返回 再++
void test02() {
    MyInteger myInt;
    cout << myInt++ << endl;
    cout << myInt << endl;
}

int main() {
    test02();
}